#!/bin/bash

ping -c 2 www.baidu.com
if [ "$?" != "0" ]; then
    date >> /tmp/portal.log
    echo "Sorry, You have disnnected to the network." >> /tmp/portal.log
    echo "Now, i'm trying to connect the network." >> /tmp/portal.log
    portal.py
else
    date >> /tmp/portal.log
    echo "Congratulation! You're connecting to the network now." >> /tmp/portal.log
fi
